package com.yjhh.scala


trait _Logger {
  def log(msg: String) = {
    println(msg)
  }
}

trait DataAccess {
  //  val loggger = new _Logger {}

  def query(input: String): String = {
    //    loggger.log(input)
    "Result" + input
  }

}

class OOPAdvancedA {
  private var name: String = "test"
  var addr: String = "addr"
  val age: Int = 12

  private[this] var sex: String = "0"


  override def toString: String = {
    sex = "1"
    name + "   " + addr + "     " + sex
  }

  def addr_(addr: String) = {
    this.addr += "1"
  }

}

object OOPAdvanced {

  def main(args: Array[String]): Unit = {
    val advanced = new OOPAdvancedA()
    //advanced.name = "111"    //set 和 get方法是私有的
    advanced.addr = "222"
    //advanced.age = 14     //val 不会生成set方法，只有get方法

    println(advanced)
  }


}
